{include file="public/header" /}

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{:lang('change password')}
                        <!--<small>定期修改密码有益账号安全</small>-->
                    </h5>
                </div>
                <div class="ibox-content">
                    <form method="get" class="form-horizontal" id="form1">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('input old password please')}</label>
                            <div class="col-sm-10">
                                <input name="oldPwd" type="password" class="form-control"
                                       value="">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('input new password please')}</label>
                            <div class="col-sm-10">
                                <input name="newPwd" type="password" class="form-control"
                                       value="">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{:lang('repeat new password please')}</label>
                            <div class="col-sm-10">
                                <input name="reNewPwd" type="password" class="form-control"
                                       value="">
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="doSubmit()">{:lang('edit')}</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    function doSubmit() {
        $.ajax({
            url: "{:U('Admin/changePwd')}",
            type: 'post',
            data: $('#form1').serialize(),
            dataType: 'JSON',
            success: function (data) {
                if (data.status == 1) {
                    layer.msg(data.msg);
                    setTimeout(function () {
                        location.reload();
                    }, 1000)
                } else {
                    layer.msg(data.msg);
                }
            }
        });
        return false;
    }
</script>
